package com.ysd.lis.controller.sys;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.SysUserInstrSetup;
import com.ysd.lis.service.SysUserInstrSetupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户仪器关系表 前端控制器
 * </p>
 *
 * @author LiuQi
 * @since 2024-01-04
 */
@Api(tags = "用户与仪器对照关系")
@RestController
@RequestMapping("/api/userInstrSetup")
public class SysUserInstrSetupController extends BaseController {

    @Autowired
    public SysUserInstrSetupService sysUserInstrSetupService;

    @ApiOperation("根据用户id获取对应关系")
    @GetMapping("/findSysUserInstrSetupList/{userId}")
    public Result findSysUserInstrSetupList(@PathVariable("userId") String userId) {
        return sysUserInstrSetupService.findSysUserInstrSetupList(userId);
    }

    @ApiOperation("添加对应关系")
    @PostMapping("/addUserInstrSetUp")
    public Result addUserInstrSetUp(@RequestBody SysUserInstrSetup sysUserInstrSetup) {
        return sysUserInstrSetupService.addUserInstrSetUp(sysUserInstrSetup);
    }

    @ApiOperation("批量添加对应关系")
    @PostMapping("/addBatchUserInstrSetUp")
    public Result addBatchUserInstrSetUp(@RequestBody List<SysUserInstrSetup> sysUserInstrSetups) {
        return sysUserInstrSetupService.addBatchUserInstrSetUp(sysUserInstrSetups);
    }

    @ApiOperation("删除对应关系")
    @PostMapping("/deleteUserInstrSetUp")
    public Result deleteUserInstrSetUp(@RequestBody SysUserInstrSetup sysUserInstrSetup) {
        return sysUserInstrSetupService.deleteUserInstrSetUp(sysUserInstrSetup);
    }
}
